package org.com.myfb.action;

import java.util.Date;

import org.com.myfb.dao.StudentsDaoInter;
import org.com.myfb.model.Students;
import org.com.myfb.service.StudentsServiceInter;

import com.opensymphony.xwork2.ActionSupport;

public class UpdateStudentAction extends ActionSupport{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int sid;
	private String sname;
	private String ssex;
	private String sclass;
	private Date sstarttime;
	private int sxuezhi;
	private Students student;
	private String data;
	
	private StudentsDaoInter studentsDaoImpl;
	private StudentsServiceInter studentsServiceImpl;
	
	

	public StudentsServiceInter getStudentsServiceImpl() {
		return studentsServiceImpl;
	}

	public void setStudentsServiceImpl(StudentsServiceInter studentsServiceImpl) {
		this.studentsServiceImpl = studentsServiceImpl;
	}

	public int getSid() {
		return sid;
	}

	public void setSid(int sid) {
		this.sid = sid;
	}

	public String getSname() {
		return sname;
	}

	public void setSname(String sname) {
		this.sname = sname;
	}

	public String getSsex() {
		return ssex;
	}

	public void setSsex(String ssex) {
		this.ssex = ssex;
	}

	public String getSclass() {
		return sclass;
	}

	public void setSclass(String sclass) {
		this.sclass = sclass;
	}

	public Date getSstarttime() {
		return sstarttime;
	}

	public void setSstarttime(Date sstarttime) {
		this.sstarttime = sstarttime;
	}

	public int getSxuezhi() {
		return sxuezhi;
	}

	public void setSxuezhi(int sxuezhi) {
		this.sxuezhi = sxuezhi;
	}

	
	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public StudentsDaoInter getStudentsDaoImpl() {
		return studentsDaoImpl;
	}

	public void setStudentsDaoImpl(StudentsDaoInter studentsDaoImpl) {
		this.studentsDaoImpl = studentsDaoImpl;
	}
	
	
	public Students getStudent() {
		return student;
	}

	public void setStudent(Students student) {
		this.student = student;
	}

	public String execute(){
		Students student = new Students();
		student = this.getStudentsDaoImpl().get(Students.class, this.sid);
		this.getStudentsServiceImpl().updateStudents(student,this.getSname(),this.getSsex(),this.getSclass(),this.getSstarttime(),this.getSxuezhi());
		this.setData("[{\"message\":\"success\"}]");
		return SUCCESS;
	}

}
